/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * Project Name: lmrp-android app
 * Create Time: 16-2-16 下午6:29
 */

package com.lenovo.mso2o.biz;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.lenovo.framework.util.DLog;
import com.lenovo.mso2o.entity.g.DaoMaster;

import static com.lenovo.mso2o.entity.g.DaoMaster.dropAllTables;


/**
 * Created by hippo on 6/4/15.
 */
public class FDevOpenHelper extends DaoMaster.DevOpenHelper {
    public FDevOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        DLog.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
        if(newVersion > oldVersion) {
            dropAllTables(db, true);
            onCreate(db);
        }
    }
}
